class A extends React.Component{
	state={car:"奔驰"}
	changeCar=()=>{
	  this.setState({car:"奥拓"});
	}
	render(){
		return (
			<div>
				<div>A组件</div>
				<button onClick={this.changeCar}> 换车</button>
				<B car={this.state.car}/>
			</div>
		)
	}
}
class B extends React.Component{
	componentWillReceiveProps(props){
		console.log("B--componentWillReceiveProps")
	}
	render(){
		return (
			<div>我是B组件,接收到的车为{this.props.car}</div>
		)
	}
}
ReactDOM.render(<A/>,document.getElementById("test"));
